package com.meihuayishu.backend.dto;

import lombok.Data;
import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.time.LocalDateTime;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(description = "用户认证响应")
public class UserAuthResponse {
    
    @Schema(description = "用户ID", example = "user_1704096000123")
    private String userId;
    
    @Schema(description = "访问令牌")
    private String accessToken;
    
    @Schema(description = "刷新令牌")
    private String refreshToken;
    
    @Schema(description = "令牌有效期(秒)", example = "7200")
    private Integer expiresIn;
    
    @Schema(description = "用户信息")
    private UserInfo userInfo;
    
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "用户信息")
    public static class UserInfo {
        @Schema(description = "用户ID", example = "user_1704096000123")
        private String userId;
        
        @Schema(description = "脱敏手机号", example = "138****8000")
        private String phone;
        
        @Schema(description = "昵称", example = "易学爱好者")
        private String nickname;
        
        @Schema(description = "头像URL")
        private String avatar;
        
        @Schema(description = "等级", example = "初学者")
        private String level;
        
        @Schema(description = "经验值", example = "0")
        private Integer experience;
        
        @Schema(description = "会员类型", example = "FREE")
        private String membershipType;
        
        @Schema(description = "会员到期时间")
        private LocalDateTime membershipExpiry;
        
        @Schema(description = "注册时间")
        private LocalDateTime registerTime;
        
        @Schema(description = "最后登录时间")
        private LocalDateTime lastLoginTime;
    }
}